package arcane.constant;

import java.awt.Color;
import java.awt.Transparency;
import java.awt.event.KeyEvent;
import java.awt.image.BufferedImage;

import com.golden.gamedev.engine.BaseInput;
import com.golden.gamedev.object.GameFontManager;
import com.golden.gamedev.object.font.BitmapFont;
import com.golden.gamedev.util.ImageUtil;

public class Constants {
	public static final GameFontManager fontManager = new GameFontManager();
	public static BaseInput keyStroke;
	static {
		fontManager.putFont("MenuFont", fontManager
				.getFont(getImage("Images/Menu/font2.png")));
	}
	public static Color CLEAR_COLOR = Color.BLACK;
	public static int ORIGIN_X = 0, ORIGIN_Y = 0, GAME_WIDTH = 640,
			GAME_HEIGHT = 480;

	public static int MOVE_LEFT = KeyEvent.VK_LEFT;
	public static int MOVE_RIGHT = KeyEvent.VK_RIGHT;
	public static int MOVE_UP = KeyEvent.VK_UP;
	public static int MOVE_DOWN = KeyEvent.VK_DOWN;

	public static int CAST_SPELL = KeyEvent.VK_SPACE;
	public static int PHYSICAL_ATTACK = KeyEvent.VK_DELETE;

	public static int CYCLE_SPELL_FORWARD = KeyEvent.VK_PAGE_UP;
	public static int CYCLE_SPELL_BACK = KeyEvent.VK_PAGE_DOWN;

	public static int CALL_MENU = KeyEvent.VK_M;
	public static int CHAT = KeyEvent.VK_ENTER;

	public static final Color PURPLE = new Color(.5f, 0f, .5f, .5f);

	/**
	 * Java script reference name to the main chat window in lounge for
	 * multiplayer chat.
	 */
	public static final String MAIN_CHAT_REF = "MAIN_CHAT";

	/**
	 * Java script reference name to the room this client is in.
	 */
	public static final String ROOM_REF = "ROOMS";

	/**
	 * Java script reference name to a clients current party.
	 */
	public static final String PARTY_REF = "PARTY";

	public static BufferedImage getImage(String path) {
		return ImageUtil.getImage(ClassLoader.getSystemResource(path),
				Transparency.TRANSLUCENT);
	}

	public static BitmapFont scaleFont(BitmapFont font, double scaleWidth, int height) {
		BufferedImage[] imgs = font.getImageFont();
		BufferedImage[] copy = new BufferedImage[imgs.length];
		for (int i = 0; i < copy.length; i++) {
			copy[i] = ImageUtil.resize(imgs[i],
					(int) (imgs[i].getWidth() * scaleWidth), height);
		}
		return new BitmapFont(copy);
	}
}
